﻿using Microsoft.EntityFrameworkCore;
using Simple.Admin.Domain.Models;
using Simple.Common.Core.Config;
using Simple.Common.EntityFrameworkCore.EntityFrameworkCore;

namespace Simple.Admin.EntityFrameworkCore.EntityFrameworkCore
{
    public class AdminDbContext : EFDbContext<AdminDbContext>
    {
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {

            if (optionsBuilder.IsConfigured) return;
            var configuration = ConfigurationHelper.GetValueByKey("ConnectionString:ERPDB");
#if DEBUG
            optionsBuilder.UseLoggerFactory(myLoggerFactory).UseSqlServer(configuration); ;
#else
            optionsBuilder.UseSqlServer(configuration);
#endif
        }
        public DbSet<AdminUser> AdminUsers { get; set; }
    }
}
